class Solution(object):
    def mergeTriplets(self, triplets, target):
        flag1 = False
        flag2 = False
        flag3 = False
        for x, y, z in triplets:
            if x == target[0] and y <= target[1] and z <= target[2]:
                flag1 = True
            if y == target[1] and x <= target[0] and z <= target[2]:
                flag2 = True
            if z == target[2] and y <= target[1] and x <= target[0]:
                flag3 = True
        return flag1 and flag2 and flag3
